<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			/* 后代选择 */
			ul li {
				float: left;
				margin-left: 10px;
				line-height: 50px;
			}
			
			ul {
				list-style: none;
				background-color: #00FFFF;
				/* height: 50px; */
				/* overflow: hidden; */
			}
			
			/* 最优解
				1、写在浮动元素的父标签上
				2、以上三个属性缺一不可
			 */
			ul::after {
				display: block;
				clear: both;
				content: "";
			}
		</style>
	</head>
	<body>
		<ul>
			<li>Java</li>
			<li>JavaScript</li>
			<li>HTML</li>
			<li>CSS</li>
			<!-- <div style="clear: both;"></div> -->
			<li>Java</li>
			<li>JavaScript</li>
			<li>HTML</li>
			<li>CSS</li>
			<!-- <div style="clear: both;"></div> -->
		</ul>
	</body>
</html>
